﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>某某后台管理</title>
    <!-- Bootstrap 核心 CSS 文件 -->
    <link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/login-styles.css" rel="stylesheet"/>
</head>

<body>
    <div class="cl-container">
        <div class="cl-row cl-row-centered">
            <div class="well col-md-2 cl-col-centered">
                <h3>某某后台管理系统</h3>
                <div class="form-group input-group">
                    <span class="input-group-addon">账号</span>
                    <input type="text" id="username_input" class="form-control"
                           placeholder="邮箱账号">
                </div>
                <div class="form-group input-group">
                    <span class="input-group-addon">密码</span>
                    <input type="password" id="password_input" class="form-control"
                           onkeyup="login(true, event)"
                           placeholder="">
                </div>
                <div id="error_tips" hidden="hidden"><label class="control-label">Input with error</label></div>
                
                <button type="submit" class="btn btn-success btn-block"  onclick="login(false)">登录</button>
            </div>
        </div>
    </div>
    <script>
        function loginCallback(success, msg) {
            console.log("loginCallback " + success + " " + msg);
            if (success) {
                // 登录成功
                window.location.href = "/console/";
            } else {
                alert(msg)
            }
        }
        function login(button, event) {
            if (button) {
                if (event != null && event.keyCode==13) {
                    api_login($('#username_input').val(), $('#password_input').val(), loginCallback);
                    return false;
                }
            } else {
                api_login($('#username_input').val(), $('#password_input').val(), loginCallback);
            }
        }
    </script>

    <script src="assets/js/request.js"></script>
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>

</html>